<?phpnamespace App\Repositories\Api;use App\Models\Kefu;class KefuRepository{    /**     * @param null $city     */    public function getOneByCity($city = null, $gender = null)    {        return Kefu::query()->where("city", "=", $city)->when(!empty($city), function ($q) use ($city, $gender) {            $type = 1;            if ($city == '南京' || $city == '上海') {                $type = $gender == "F" ? 3 : ($gender == 'M' ? 2 : 1);            }            return $q->where("type", "=", $type);        })->first();    }}